import React from "react";
import { Text } from "react-native";
import { Button as AntdButton } from "@ant-design/react-native";
import styles from "./styles";

const PrimaryButton = ({
  style = {},
  onPress,
  children,
  type = "primary",
  textStyle = {},
}) => {
  if (type === "primary") {
    return (
      <AntdButton
        style={{
          ...styles.primaryButton,
          ...style,
        }}
        onPress={onPress}
        activeStyle={styles.primaryButtonActive}
      >
        <Text style={{ ...styles.primaryButtonText, ...textStyle }}>
          {children}
        </Text>
      </AntdButton>
    );
  }
  return (
    <AntdButton
      style={{
        ...styles.cancelButton,
        ...style,
      }}
      onPress={onPress}
      activeStyle={styles.cancelButtonActive}
    >
      <Text style={styles.cancelButtonText}>{children}</Text>
    </AntdButton>
  );
};

export default PrimaryButton;
